<template>
  <div>
    <el-dialog title="角色页面" :visible="isShowDialog" @close="btnPermCancel">
      <el-checkbox-group v-model="checkList">
        <el-checkbox
          v-for="inde in list"
          :key="inde.id"
          :label="inde.id"
        >{{ inde.name }}</el-checkbox>
      </el-checkbox-group>
      <template #footer>
        <el-button size="small" type="primary" @click="benOK">确定</el-button>
        <el-button size="small" @click="btnPermCancel">取消</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { getroleInfo } from '@/api/setting'
import { assignRole } from '@/api/employee'
export default {
  props: {
    isShowDialog: {
      type: Boolean,
      default: false

    }
  },
  data() {
    return {
      id: '',
      checkList: [],
      list: []
    }
  },
  async created() {
    const res = await getroleInfo({
      page: 1,
      pageSize: 99
    })
    // console.log('角色列表数据', res)
    this.list = res.rows
  },
  methods: {
    async benOK() {
      console.log(123)
      await assignRole({
        id: this.id,
        roleIds: this.checkList
      })
      this.$message.success('操作成功')
      this.$emit('closeDialog')
    },
    btnPermCancel() {
    //   this.isShowDialog = false
      this.$emit('closeDialog')
    }
  }
}
</script>

<style>

</style>
